package com.cerosoft.components;

import com.cerosoft.R;
import com.cerosoft.api.http.webservices.MediaBrowserWebServiceProxy;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;

public class DynamicThumbnailView extends AbstractDynamicImageView {

	public DynamicThumbnailView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void getViewByIndex() {
		if (getImgs() == null) {
			return;
		}
		Bitmap bm = MediaBrowserWebServiceProxy.getInstance()
				.getThumbnailViaURL(getIpAddr(), getImgs().get(getCurrIndex()));
		if (bm != null) {
			setImageBitmap(bm);
		} else {
			setImageResource(R.drawable.file);
		}
	}

}
